<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!-- NewPage -->
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>org.apache.commons.io.filefilter (Apache Commons IO 2.5 API)</title>
<link rel="stylesheet" type="text/css" href="../../../../../stylesheet.css" title="Style">
</head>
<body>
<script type="text/javascript"><!--
    if (location.href.indexOf('is-external=true') == -1) {
        parent.document.title="org.apache.commons.io.filefilter (Apache Commons IO 2.5 API)";
    }
//-->
</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<!-- ========= START OF TOP NAVBAR ======= -->
<div class="topNav"><a name="navbar_top">
<!--   -->
</a><a href="#skip-navbar_top" title="Skip navigation links"></a><a name="navbar_top_firstrow">
<!--   -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../../overview-summary.html">Overview</a></li>
<li class="navBarCell1Rev">Package</li>
<li>Class</li>
<li><a href="package-use.html">Use</a></li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../../index-all.html">Index</a></li>
<li><a href="../../../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li><a href="../../../../../org/apache/commons/io/comparator/package-summary.html">Prev Package</a></li>
<li><a href="../../../../../org/apache/commons/io/input/package-summary.html">Next Package</a></li>
</ul>
<ul class="navList">
<li><a href="../../../../../index.html?org/apache/commons/io/filefilter/package-summary.html" target="_top">Frames</a></li>
<li><a href="package-summary.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_top">
<li><a href="../../../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
  allClassesLink = document.getElementById("allclasses_navbar_top");
  if(window==top) {
    allClassesLink.style.display = "block";
  }
  else {
    allClassesLink.style.display = "none";
  }
  //-->
</script>
</div>
<a name="skip-navbar_top">
<!--   -->
</a></div>
<!-- ========= END OF TOP NAVBAR ========= -->
<div class="header">
<h1 title="Package" class="title">Package&nbsp;org.apache.commons.io.filefilter</h1>
<div class="docSummary">
<div class="block">This package defines an interface (IOFileFilter) that combines both 
<a href="http://docs.oracle.com/javase/7/docs/api/java/io/FileFilter.html?is-external=true" title="class or interface in java.io"><code>FileFilter</code></a> and <a href="http://docs.oracle.com/javase/7/docs/api/java/io/FilenameFilter.html?is-external=true" title="class or interface in java.io"><code>FilenameFilter</code></a>.</div>
</div>
<p>See:&nbsp;<a href="#package_description">Description</a></p>
</div>
<div class="contentContainer">
<ul class="blockList">
<li class="blockList">
<table class="packageSummary" border="0" cellpadding="3" cellspacing="0" summary="Interface Summary table, listing interfaces, and an explanation">
<caption><span>Interface Summary</span><span class="tabEnd">&nbsp;</span></caption>
<tr>
<th class="colFirst" scope="col">Interface</th>
<th class="colLast" scope="col">Description</th>
</tr>
<tbody>
<tr class="altColor">
<td class="colFirst"><a href="../../../../../org/apache/commons/io/filefilter/ConditionalFileFilter.html" title="interface in org.apache.commons.io.filefilter">ConditionalFileFilter</a></td>
<td class="colLast">
<div class="block">Defines operations for conditional file filters.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><a href="../../../../../org/apache/commons/io/filefilter/IOFileFilter.html" title="interface in org.apache.commons.io.filefilter">IOFileFilter</a></td>
<td class="colLast">
<div class="block">An interface which brings the FileFilter and FilenameFilter
 interfaces together.</div>
</td>
</tr>
</tbody>
</table>
</li>
<li class="blockList">
<table class="packageSummary" border="0" cellpadding="3" cellspacing="0" summary="Class Summary table, listing classes, and an explanation">
<caption><span>Class Summary</span><span class="tabEnd">&nbsp;</span></caption>
<tr>
<th class="colFirst" scope="col">Class</th>
<th class="colLast" scope="col">Description</th>
</tr>
<tbody>
<tr class="altColor">
<td class="colFirst"><a href="../../../../../org/apache/commons/io/filefilter/AbstractFileFilter.html" title="class in org.apache.commons.io.filefilter">AbstractFileFilter</a></td>
<td class="colLast">
<div class="block">An abstract class which implements the Java FileFilter and FilenameFilter 
 interfaces via the IOFileFilter interface.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><a href="../../../../../org/apache/commons/io/filefilter/AgeFileFilter.html" title="class in org.apache.commons.io.filefilter">AgeFileFilter</a></td>
<td class="colLast">
<div class="block">Filters files based on a cutoff time, can filter either newer
 files or files equal to or older.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><a href="../../../../../org/apache/commons/io/filefilter/AndFileFilter.html" title="class in org.apache.commons.io.filefilter">AndFileFilter</a></td>
<td class="colLast">
<div class="block">A <a href="http://docs.oracle.com/javase/7/docs/api/java/io/FileFilter.html?is-external=true" title="class or interface in java.io"><code>FileFilter</code></a> providing conditional AND logic across a list of
 file filters.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><a href="../../../../../org/apache/commons/io/filefilter/CanReadFileFilter.html" title="class in org.apache.commons.io.filefilter">CanReadFileFilter</a></td>
<td class="colLast">
<div class="block">This filter accepts <code>File</code>s that can be read.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><a href="../../../../../org/apache/commons/io/filefilter/CanWriteFileFilter.html" title="class in org.apache.commons.io.filefilter">CanWriteFileFilter</a></td>
<td class="colLast">
<div class="block">This filter accepts <code>File</code>s that can be written to.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><a href="../../../../../org/apache/commons/io/filefilter/DelegateFileFilter.html" title="class in org.apache.commons.io.filefilter">DelegateFileFilter</a></td>
<td class="colLast">
<div class="block">This class turns a Java FileFilter or FilenameFilter into an IO FileFilter.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><a href="../../../../../org/apache/commons/io/filefilter/DirectoryFileFilter.html" title="class in org.apache.commons.io.filefilter">DirectoryFileFilter</a></td>
<td class="colLast">
<div class="block">This filter accepts <code>File</code>s that are directories.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><a href="../../../../../org/apache/commons/io/filefilter/EmptyFileFilter.html" title="class in org.apache.commons.io.filefilter">EmptyFileFilter</a></td>
<td class="colLast">
<div class="block">This filter accepts files or directories that are empty.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><a href="../../../../../org/apache/commons/io/filefilter/FalseFileFilter.html" title="class in org.apache.commons.io.filefilter">FalseFileFilter</a></td>
<td class="colLast">
<div class="block">A file filter that always returns false.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><a href="../../../../../org/apache/commons/io/filefilter/FileFileFilter.html" title="class in org.apache.commons.io.filefilter">FileFileFilter</a></td>
<td class="colLast">
<div class="block">This filter accepts <code>File</code>s that are files (not directories).</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><a href="../../../../../org/apache/commons/io/filefilter/FileFilterUtils.html" title="class in org.apache.commons.io.filefilter">FileFilterUtils</a></td>
<td class="colLast">
<div class="block">Useful utilities for working with file filters.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><a href="../../../../../org/apache/commons/io/filefilter/HiddenFileFilter.html" title="class in org.apache.commons.io.filefilter">HiddenFileFilter</a></td>
<td class="colLast">
<div class="block">This filter accepts <code>File</code>s that are hidden.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><a href="../../../../../org/apache/commons/io/filefilter/MagicNumberFileFilter.html" title="class in org.apache.commons.io.filefilter">MagicNumberFileFilter</a></td>
<td class="colLast">
<div class="block">
 File filter for matching files containing a "magic number".</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><a href="../../../../../org/apache/commons/io/filefilter/NameFileFilter.html" title="class in org.apache.commons.io.filefilter">NameFileFilter</a></td>
<td class="colLast">
<div class="block">Filters filenames for a certain name.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><a href="../../../../../org/apache/commons/io/filefilter/NotFileFilter.html" title="class in org.apache.commons.io.filefilter">NotFileFilter</a></td>
<td class="colLast">
<div class="block">This filter produces a logical NOT of the filters specified.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><a href="../../../../../org/apache/commons/io/filefilter/OrFileFilter.html" title="class in org.apache.commons.io.filefilter">OrFileFilter</a></td>
<td class="colLast">
<div class="block">A <a href="http://docs.oracle.com/javase/7/docs/api/java/io/FileFilter.html?is-external=true" title="class or interface in java.io"><code>FileFilter</code></a> providing conditional OR logic across a list of
 file filters.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><a href="../../../../../org/apache/commons/io/filefilter/PrefixFileFilter.html" title="class in org.apache.commons.io.filefilter">PrefixFileFilter</a></td>
<td class="colLast">
<div class="block">Filters filenames for a certain prefix.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><a href="../../../../../org/apache/commons/io/filefilter/RegexFileFilter.html" title="class in org.apache.commons.io.filefilter">RegexFileFilter</a></td>
<td class="colLast">
<div class="block">Filters files using supplied regular expression(s).</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><a href="../../../../../org/apache/commons/io/filefilter/SizeFileFilter.html" title="class in org.apache.commons.io.filefilter">SizeFileFilter</a></td>
<td class="colLast">
<div class="block">Filters files based on size, can filter either smaller files or
 files equal to or larger than a given threshold.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><a href="../../../../../org/apache/commons/io/filefilter/SuffixFileFilter.html" title="class in org.apache.commons.io.filefilter">SuffixFileFilter</a></td>
<td class="colLast">
<div class="block">Filters files based on the suffix (what the filename ends with).</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><a href="../../../../../org/apache/commons/io/filefilter/TrueFileFilter.html" title="class in org.apache.commons.io.filefilter">TrueFileFilter</a></td>
<td class="colLast">
<div class="block">A file filter that always returns true.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><a href="../../../../../org/apache/commons/io/filefilter/WildcardFileFilter.html" title="class in org.apache.commons.io.filefilter">WildcardFileFilter</a></td>
<td class="colLast">
<div class="block">Filters files using the supplied wildcards.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><a href="../../../../../org/apache/commons/io/filefilter/WildcardFilter.html" title="class in org.apache.commons.io.filefilter">WildcardFilter</a></td>
<td class="colLast">Deprecated
<div class="block"><i>Use WilcardFileFilter.</i></div>
</td>
</tr>
</tbody>
</table>
</li>
</ul>
<a name="package_description">
<!--   -->
</a>
<h2 title="Package org.apache.commons.io.filefilter Description">Package org.apache.commons.io.filefilter Description</h2>
<div class="block"><p>This package defines an interface (IOFileFilter) that combines both 
<a href="http://docs.oracle.com/javase/7/docs/api/java/io/FileFilter.html?is-external=true" title="class or interface in java.io"><code>FileFilter</code></a> and <a href="http://docs.oracle.com/javase/7/docs/api/java/io/FilenameFilter.html?is-external=true" title="class or interface in java.io"><code>FilenameFilter</code></a>. Besides
that the package offers a series of ready-to-use implementations of the
IOFileFilter interface including implementation that allow you to combine
other such filters.</p>
<p>These filter can be used to list files or in <a href="http://docs.oracle.com/javase/7/docs/api/java/awt/FileDialog.html?is-external=true" title="class or interface in java.awt"><code>FileDialog</code></a>, 
for example.</p>
     
<p>There are a number of 'primitive' filters:</p>
     
<table>
       <tbody>
    <tr>
      <td><a href="DirectoryFileFilter.html">DirectoryFilter</a></td>
      <td>Only accept directories</td>
    </tr>
       <tr>
      <td><a href="PrefixFileFilter.html">PrefixFileFilter</a></td>
      <td>Filter based on a prefix</td>
    </tr>
       <tr>
      <td><a href="SuffixFileFilter.html">SuffixFileFilter</a></td>
      <td>Filter based on a suffix</td>
    </tr>
    <tr>
      <td><a href="NameFileFilter.html">NameFileFilter</a></td>
      <td>Filter based on a filename</td>
    </tr>
    <tr>
      <td><a href="WildcardFileFilter.html">WildcardFileFilter</a></td>
      <td>Filter based on wildcards</td>
    </tr>
    <tr>
      <td><a href="AgeFileFilter.html">AgeFileFilter</a></td>
      <td>Filter based on last modified time of file</td>
    </tr>
    <tr>
      <td><a href="SizeFileFilter.html">SizeFileFilter</a></td>
      <td>Filter based on file size</td>
    </tr>
  </tbody>
</table>
     
<p>And there are five 'boolean' filters:</p>
     
<table>
       <tbody>
       <tr>
      <td><a href="TrueFileFilter.html">TrueFileFilter</a></td>
      <td>Accept all files</td>
    </tr>
       <tr>
      <td><a href="FalseFileFilter.html">FalseFileFilter</a></td>
      <td>Accept no files</td>
    </tr>
       <tr>
      <td><a href="NotFileFilter.html">NotFileFilter</a></td>
      <td>Applies a logical NOT to an existing filter</td>
    </tr>
    <tr>
      <td><a href="AndFileFilter.html">AndFileFilter</a></td>
      <td>Combines two filters using a logical AND</td>
    </tr>
       <tr>
      <td><a href="OrFileFilter.html">OrFileFilter</a></td>
      <td>Combines two filter using a logical OR</td>
    </tr>
     
  </tbody>
</table>
      
<p>These boolean FilenameFilters can be nested, to allow arbitrary expressions.
For example, here is how one could print all non-directory files in the
current directory, starting with "A", and ending in ".java" or ".class":</p>
     
<pre>
  File dir = new File(".");
  String[] files = dir.list( 
    new AndFileFilter(
      new AndFileFilter(
        new PrefixFileFilter("A"),
        new OrFileFilter(
          new SuffixFileFilter(".class"),
          new SuffixFileFilter(".java")
        )
      ),
      new NotFileFilter(
        new DirectoryFileFilter()
      )
    )
  );
  for ( int i=0; i&lt;files.length; i++ ) {
    System.out.println(files[i]);
  }
</pre>

<p>This package also contains a utility class: 
<a href="FileFilterUtils.html">FileFilterUtils</a>. It allows you to use all 
file filters without having to put them in the import section. Here's how the 
above example will look using FileFilterUtils:</p>
<pre>
  File dir = new File(".");
  String[] files = dir.list( 
    FileFilterUtils.andFileFilter(
      FileFilterUtils.andFileFilter(
        FileFilterUtils.prefixFileFilter("A"),
        FileFilterUtils.orFileFilter(
          FileFilterUtils.suffixFileFilter(".class"),
          FileFilterUtils.suffixFileFilter(".java")
        )
      ),
      FileFilterUtils.notFileFilter(
        FileFilterUtils.directoryFileFilter()
      )
    )
  );
  for ( int i=0; i&lt;files.length; i++ ) {
    System.out.println(files[i]);
  }
</pre>
<p>There are a few other goodies in that class so please have a look at the 
documentation in detail.</p></div>
</div>
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<div class="bottomNav"><a name="navbar_bottom">
<!--   -->
</a><a href="#skip-navbar_bottom" title="Skip navigation links"></a><a name="navbar_bottom_firstrow">
<!--   -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../../overview-summary.html">Overview</a></li>
<li class="navBarCell1Rev">Package</li>
<li>Class</li>
<li><a href="package-use.html">Use</a></li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../../index-all.html">Index</a></li>
<li><a href="../../../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li><a href="../../../../../org/apache/commons/io/comparator/package-summary.html">Prev Package</a></li>
<li><a href="../../../../../org/apache/commons/io/input/package-summary.html">Next Package</a></li>
</ul>
<ul class="navList">
<li><a href="../../../../../index.html?org/apache/commons/io/filefilter/package-summary.html" target="_top">Frames</a></li>
<li><a href="package-summary.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_bottom">
<li><a href="../../../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
  allClassesLink = document.getElementById("allclasses_navbar_bottom");
  if(window==top) {
    allClassesLink.style.display = "block";
  }
  else {
    allClassesLink.style.display = "none";
  }
  //-->
</script>
</div>
<a name="skip-navbar_bottom">
<!--   -->
</a></div>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
<p class="legalCopy"><small>Copyright &#169; 2002&#x2013;2016 <a href="http://www.apache.org/">The Apache Software Foundation</a>. All rights reserved.</small></p>
</body>
</html>
